Passed
Pull Request — master (#101)
by Mathieu
02:08
created

UserAdministrative1588426823331   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 14
c 0
b 0
f 0
rs 10

2 Functions

Rating   Name   Duplication   Size   Complexity  
A down 0 5 1
A up 0 5 1
1
import {MigrationInterface, QueryRunner} from "typeorm";
2
3
export class UserAdministrative1588426823331 implements MigrationInterface {
4
    name = 'UserAdministrative1588426823331'
5
6
    public async up(queryRunner: QueryRunner): Promise<any> {
7
        await queryRunner.query(`CREATE TYPE "user_administrative_contract_enum" AS ENUM('cdi', 'cdd', 'ctt', 'apprenticeship', 'professionalization')`, undefined);
8
        await queryRunner.query(`CREATE TABLE "user_administrative" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "joiningDate" TIMESTAMP NOT NULL, "leavingDate" TIMESTAMP, "annualEarnings" integer NOT NULL, "transportFee" integer DEFAULT 0, "healthInsurance" boolean NOT NULL, "executivePosition" boolean NOT NULL, "contract" "user_administrative_contract_enum" NOT NULL, CONSTRAINT "PK_3a17ceae75a0f330edb671f4b76" PRIMARY KEY ("id"))`, undefined);
9
        await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "entryDate"`, undefined);
10
    }
11
12
    public async down(queryRunner: QueryRunner): Promise<any> {
13
        await queryRunner.query(`ALTER TABLE "user" ADD "entryDate" TIMESTAMP`, undefined);
14
        await queryRunner.query(`DROP TABLE "user_administrative"`, undefined);
15
        await queryRunner.query(`DROP TYPE "user_administrative_contract_enum"`, undefined);
16
    }
17
18
}
19